﻿using DotNetCommon;
using DotNetCommon.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace DBUtil.FastEntity.Builders
{
    public abstract class Builder<T> where T : class, new()
    {
        protected EntityManager<T> entityManager = null;
        protected DBAccess db => entityManager.db;
        internal Builder(EntityManager<T> entityManager)
        {
            this.entityManager = entityManager;
        }

        public bool IsCurdBefore => db.Settings.GetExtend<EntitySetting>(EntitySetting.ExtendKey).CurdBefore.IsNotNullOrEmpty();
        public List<Action<EntityCurdBeforeArgument>> BeforeActions => db.Settings.GetExtend<EntitySetting>(EntitySetting.ExtendKey).CurdBefore;
        public bool IsCurdAfter => db.Settings.GetExtend<EntitySetting>(EntitySetting.ExtendKey).CurdAfter.IsNotNullOrEmpty();
        public List<Action<EntityCurdAfterArgument>> AfterActions => db.Settings.GetExtend<EntitySetting>(EntitySetting.ExtendKey).CurdAfter;
    }
}
